<?php

class Admin extends Controller {

	//function __construct()
    function Admin()
    {
        parent::Controller();
        $this->load->model('test_model');
        $this->load->library('form_validation');
    }

    function users()
    {
        $this->load->view('admin/users');
    }

    function edit()
    {
        $this->load->view('admin/edit');
    }

    function IsAdmin()
    {
        if ($this->session->userdata('is_logged_in'))
        {
            $this->load->helper('user');
            if (check_user_role() != 1)
                echo "You are not authorized to see the administrative area.";
            else
                echo "Hello world! Your user ID is: " . $this->session->userdata('is_logged_in');
            }
        else
            echo "You are not logged in!";
        }

    function listusers()
    {
            //Load up my model and get the user records
            $this->load->model('test_model');
            $user_records = $this->test_model->list_users();

            //Prepare the data array to send data to the view
            $data = array();
            $data['results'] = $user_records;

            //Load the view, sending it my data
            $this->load->view('admin/users', $data);
    }

}

/* EOF */